package com.ljsw.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ljsw.activity.R;
import com.ljsw.entity.pkentity.PKNotCompleteInfoEntity;

import java.util.List;

/**
 * Created by lianchao on 2020/10/15.
 * 未完成明细适配器
 * lianch
 */


public class NotCompletedInfoAdapter extends BaseAdapter {

    private List<PKNotCompleteInfoEntity> LockID;
    private Context mContext;

    public NotCompletedInfoAdapter(List<PKNotCompleteInfoEntity> LockID, Context mContext) {
        super();
        this.LockID = LockID;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return LockID.size();
    }

    @Override
    public Object getItem(int position) {
        return LockID.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        NotCompletedInfoAdapter.ViewHolder mviewHolder = null;
        if (mviewHolder == null) {
            mviewHolder = new NotCompletedInfoAdapter.ViewHolder();
            LayoutInflater inflater = LayoutInflater.from(mContext);
            convertView = inflater.inflate(R.layout.pklistinfo_notcompletedinfo, null);

            TextView PKNo = (TextView) convertView.findViewById(R.id.PKNotno);
            TextView PKtime = (TextView) convertView.findViewById(R.id.PKnottime);
            TextView PKState = (TextView) convertView.findViewById(R.id.PKnotcomState);
            TextView PKState1 = (TextView) convertView.findViewById(R.id.PKState1);
            mviewHolder.tv = PKNo;
            mviewHolder.tvtime = PKtime;
            mviewHolder.tvstate = PKState;
            mviewHolder.PKState1 = PKState1;
            convertView.setTag(mviewHolder);
        } else {
            mviewHolder = (NotCompletedInfoAdapter.ViewHolder) convertView.getTag();
            convertView.setTag(mviewHolder);
        }
        mviewHolder.tv.setText("" + LockID.get(position).getMONEYDETAIL());// 券别
        mviewHolder.tvtime.setText(LockID.get(position).getEDITIONNUM()); // 版别
        mviewHolder.tvstate.setText(LockID.get(position).getDAMAGEDSTATE());// 残损状态
        mviewHolder.PKState1.setText(LockID.get(position).getMONEY());//总额
        return convertView;
    }

    class ViewHolder {
        private TextView tv;
        private TextView tvtime;
        private TextView tvstate;
        private TextView PKState1;
    }
}
